Binary translators translate object program code between different computer architectures to enable a program written for a source architecture to be executed on a target architecture. In addition to other concerns, the binary translator should provide for accurate exception handling in the translated code, which may be difficult when the source and target architectures have different execution models. For example, the source architecture may contain multiple distinct exception masks while the target architecture supplies a single equivalent mask for the exception, such as when the source architecture supports multiple floating point function units, while the target architecture only supports a single floating point function unit.
The performance of the translated code may be greatly degraded if instructions that use different exception masks are mixed. Performance may be further degraded by the need to schedule faulty instructions in strict order so that the state of the source architecture can be correctly restored when an exception occurs.
Furthermore, given the difference between the execution models, one instruction in the source architecture is often translated to several instructions in target architecture, which may lead to an inconsistency in the state of the source architecture when an exception occurs during the execution of the corresponding translated instructions in the target architecture.